jQuery.extend(jQuery.fn, {
	'pstrength': function (options) {
		
		
		ClientSideStrongPassword=function(){
			return (IsLongEnough(ClientSideStrongPassword.arguments[0], "7") &&
			SpansEnoughCharacterSets(ClientSideStrongPassword.arguments[0], "3") &&
			(!(IsCloseVariationOfAWordInDictionary(ClientSideStrongPassword.arguments[0], "0.6", 
			ClientSideStrongPassword.arguments[1], ClientSideStrongPassword.arguments[2]))));
		}
		
		
		var CharMode=function(iN){
			if(iN>=48&&iN<=57)return 1;
			if(iN>=65&&iN<=90)return 2;
			if(iN>=97&&iN<=122)return 4;
			else return 8;
		}
		var bitTotal=function(num){
			modes=0;
			for (i=0;i<5;i++){if(num & 1) modes++;num>>>=1;}
			if(modes>2){modes=2;}
			return modes;
		}
		var checkStrong=function (sPW){
			if(sPW.length<7)return 0;
			Modes=0;
			for (i=0;i<sPW.length;i++){Modes=Modes||CharMode(sPW.charCodeAt(i));}
			return bitTotal(Modes);
		}
		
		
		$(this).each(function(){
			var position=$(this).offset();
			var $pwStrength=$('<span class="pwStrength"></span>').insertAfter($(this));
			$pwStrength.append($('<span class="pass_l">弱</span>'));
			$pwStrength.append($('<span class="pass_z">中</span>'));
			$pwStrength.append($('<span class="pass_q">强</span>'));
			$pwStrength.append($('<span></span>'));
		});
		$(this).bind("keyup",function(){
			var pwd=$(this).val();
			var pwStrength=$(this).nextAll("span.pwStrength:first");
			pwStrength.find("span").hide();
			if(pwd!=''&&pwd!=null){
				var level=checkStrong(pwd);
				pwStrength.find("span:eq("+level+")").show();
			}
		});
	}
});